{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Assignment 4"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "Write a program to identify [1,1,5] in the given list in the same order,\n",
    "if yes print \"It's a Match\"if no then print \"It's Gone\"\n",
    "\n",
    "Output should be something like this\n",
    "for examples : Listy = [1,5,6,4,1,2,3,5] -- It's a Match (only if the condition is true)\n",
    "                Listy = [1,5,6,5,1,2,3,6] -- It's Gone (if the condition is false)"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "1. Take input of 8 elements as a list\n",
    "2. Check if sublist [1,1,5] is coming in same order"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Enter number 1: 1\n",
      "Enter number 2: 4\n",
      "Enter number 3: 5\n",
      "Enter number 4: 5\n",
      "Enter number 5: 4\n",
      "Enter number 6: 4\n",
      "Enter number 7: 4\n",
      "Enter number 8: 4\n",
      "Provided List is : [1, 4, 5, 5, 4, 4, 4, 4]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "\"It's gone\""
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Function to get input from the user\n",
    "def getInput():\n",
    "    tempList=[]\n",
    "    i=0\n",
    "    while i < 8:\n",
    "        val = int(input(f\"Enter number {i+1}: \"))#search about formatted output in python for the \"f\" part\n",
    "        tempList.append(val)\n",
    "        i+=1\n",
    "    return tempList\n",
    "\n",
    "#function to check if the sublist exist in the superlist in the same order\n",
    "def check(a):\n",
    "    subList = [1,1,5]\n",
    "    for i in a:\n",
    "        for j in subList:\n",
    "            if(len(subList)>=0 and j == i):\n",
    "                subList.pop(0)\n",
    "            else:\n",
    "                break\n",
    "    \n",
    "    if len(subList)==0:\n",
    "        return \"It's a match\"\n",
    "    else:\n",
    "        return \"It's gone\"\n",
    "\n",
    "#Main\n",
    "supList = getInput()        \n",
    "print(\"Provided List is :\",supList)\n",
    "check(supList)        \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
